/*
 * MainWindow.cpp
 *
 *  Created on: Feb 1, 2009
 *      Author: tandaica0612
 */

#include "MainWindow.h"

MainWindow::MainWindow(BaseObjectType* base_object,
		  const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml)
		  :Gtk::Window(base_object){

	glade_xml->get_widget("scrolledwindow1",scrolledwindow1);
	m_TreeView = new Gtk::TreeView();
	scrolledwindow1->add(*m_TreeView);
	//Create the Tree model:
	m_refTreeModel = Gtk::ListStore::create(m_Columns);
	m_TreeView->set_model(m_refTreeModel);
	//Fill the TreeView's model
	Gtk::TreeModel::Row row = *(m_refTreeModel->append());
	row[m_Columns.m_col_id] = 1;
	row[m_Columns.m_col_name] = "Billy Bob";
	row[m_Columns.m_col_number] = 10;
	row[m_Columns.m_col_percentage] = 15;

	row = *(m_refTreeModel->append());
	row[m_Columns.m_col_id] = 2;
	row[m_Columns.m_col_name] = "Joey Jojo";
	row[m_Columns.m_col_number] = 20;
	row[m_Columns.m_col_percentage] = 40;

	row = *(m_refTreeModel->append());
	row[m_Columns.m_col_id] = 3;
	row[m_Columns.m_col_name] = "Rob McRoberts";
	row[m_Columns.m_col_number] = 30;
	row[m_Columns.m_col_percentage] = 70;
	//Add the TreeView's view columns:
	//This number will be shown with the default numeric formatting.
	m_TreeView->append_column("ID", m_Columns.m_col_id);
	m_TreeView->append_column("Name", m_Columns.m_col_name);
	m_TreeView->append_column_numeric("Formatted number", m_Columns.m_col_number,"%010d" /* 10 digits, using leading zeroes. */);
	show_all_children();
}
MainWindow::~MainWindow() {
}
